<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
    <title>星云微讯后台管理系统</title>
    <link href="<?php echo base_url(); ?>default/css_admin/admin_login.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="<?php echo base_url(); ?>default/js_admin/jquery.js"></script>
</head>
<body>
<div class="admin_login_wrap">
    <h1>星云微讯后台管理系统</h1>
    <div class="adming_login_border">
        <div class="admin_input">
                <ul class="admin_items">
                    <li>
                        <label for="user">用户名：</label>
                        <input type="text" name="username"  id="username" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <label for="pwd">密码：</label>
                        <input type="password" name="pwd"  id="pwd" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <input type="submit" tabindex="3" value="提交" onclick="but_login();" class="btn btn-primary" id="submit"/>
                    </li>
                </ul>
        </div>
    </div>
    <p class="admin_copyright"><a tabindex="5" href="#" target="_blank">返回首页</a> &copy; <?=date('Y',time())?> Powered by <a href="#" target="_blank">17KOKO后台管理</a></p>
</div>
<script type="text/javascript">
    function but_login(){
        $.ajax({
            type: "POST",
            url: "<?php echo site_url('admin/index/but_login')?>",
            data: 'username='+ $('#username').val() + '&pwd='+ $('#pwd').val(),
            success: function(data){
                var dataObj=eval("("+data+")");
                if(dataObj.num==1){

                    window.location.href="<?php echo site_url('admin/index/index')?>";
                }else{
                    alert(dataObj.error);
                    // window.location.reload();
                }

            }
        });
    }

    //按enter键触发登录按钮点击事件
    $(document).keypress(function (event) {
       if(event.keyCode==13){
           $("#submit").trigger("click");
       }
    });

</script>
</body>
</html>